<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class con_login extends CI_Controller 
{
 
    public function index()
    {
       if (!($this->session->flashdata('error'))){
           if ($this->input->post('username')){
            $this->load->model('mod_login');
            $this->mod_login->checkUsuario($this->input->post('username'),$this->input->post('password'));
            if ($this->session->userdata('login')){
                redirect('con_principal');
            }else{
                redirect('con_login');
            }
            }else{
               $this->load->view('view_login');
           }
       }else{
           $this->load->view('view_login');
       }
    }
    public function logout()
    {
        $this->session->sess_destroy();
        redirect('con_login/index');  
    }
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */